def delattrs(soup):
    for descendant in soup.descendants:
        if descendant.name and descendant.attrs and descendant.name != 'img':
            del descendant.attrs
    return soup